

from pyecharts import options as opts
from pyecharts.charts import Pie, Grid, Liquid

#查询各个分类下的内容数,绘制为饼状图
from pyecharts.commons.utils import JsCode


def pie_set(item):
    path="./templates/pie_set_color.html"
    c = (
    Pie()
    .add("", [[z['tag'],z['count']] for z in item])
    # .set_colors(["blue", "green", "yellow", "red", "pink", "orange", "purple"])
    .set_global_opts(title_opts=opts.TitleOpts(title="标签饼状图"))
    .set_series_opts(label_opts=opts.LabelOpts(formatter="{b}: {c}"))
    .render(path)
    )
    path_html=path.split('/')[-1:][0]
    return path_html


